﻿using Assets.Scripts.Data;
using Assets.Scripts.UI;
using Assets.Scripts.Enums;
using Test30.Data;
using Test30.Engine;
using UnityEngine;
using UnityEngine.UI;

namespace Assets.Scripts.App
{
    public class WelcomeScreen : Control
    {
        public WelcomeScreen() : base(UiType.Normal,UiMode.HideOther, Configs.UiPrefabsPath + Configs.PathConact + Configs.UiPrefabsNames.WelcomeScreen)
        {
        }

        public override void Init()
        {
            Load();
            GameObj.transform.Find("VerticalLayout/NewGameBtn").GetComponent<Button>()
                .onClick.AddListener(Show);
        }

        void Load()
        {
            _content = DataFiles.FromUnityLoad(Application.dataPath);
            Singletons.Get<ObjectPoolComp>("ObjectPool");
        }

        private void Show()
        {
            Ui.Run<NewHeroScreen>(_content);
        }

        private Content _content;
    }
}
